#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

struct Point {
	float px;
	float py;
};
float dist(Point& p1, Point& p2) {
	return (p1.px - p2.px) * (p1.px - p2.px) + (p1.py - p2.py) * (p1.py - p2.py);
}
float min(float x, float y) { return x < y ? x : y; }
float ClosestPair(Point* p, int left, int right) {
	float minDist = 0;
	//only 2 points
	if (right == left + 1)
		minDist = dist(p[left], p[right]);
	//3 points considered, so no possibility for only 1 point
	else if (right == left + 2){
		//minimal distance among 3 points
		minDist = min(dist(p[left], p[left + 1]), dist(p[left], p[left + 2]));
		minDist = min(minDist, dist(p[left + 1], p[left + 2]));
	}
	else {
		int mid = (left + right) / 2;
		float leftMin = ClosestPair(p, left, mid);
		float rightMin = ClosestPair(p, mid + 1, right);
		minDist = min(leftMin, rightMin);

		//find the leftmost and the rightmost point in S
		while (p[left++].px <= p[mid].px - minDist);
		while (p[right--].px >= p[mid].px + minDist);
		left -= 1;
		right += 1;
		for (int i = left; i <= right; i++)
			for (int j = i + 1; j <= right; j++)
				minDist = dist(p[i], p[j]) < minDist ? dist(p[i], p[j]) : minDist;
	}
	return minDist;
}
bool cmp(Point& a, Point& b) {
	if (a.px != b.px)
		return a.px < b.px;
	return a.py < b.py;
}
/*void sort(Point* p, int left, int right) {
	if (left < right) {
		Point temp = p[left];
		int i = left, j = right;
		while (i < j) {
			//while (i < j && (p[j].px > temp.px || (p[j].px == temp.px && p[j].py > temp.py)))
			while (i < j && p[j].px > temp.px)
				j--;
			if (i < j)
				p[i++] = p[j];
			//while (i < j && (p[i].px < temp.px || (p[j].px == temp.px && p[j].py < temp.py)))
			while (i < j && p[i].px < temp.px)
				i++;
			if (i < j)
				p[j--] = p[i];
		}
		p[i] = temp;
		sort(p, left, i - 1);
		sort(p, i + 1, right);
	}
	return;
}*/
int main() {
	int N;
	cin >> N;
	Point* points = new Point[N];
	for (int i = 0; i < N; ++i) {
		cin >> points[i].px;
		cin >> points[i].py;

	}
	if (N == 1) {
		float ans = 0;
		cout << fixed << setprecision(2) << ans;
		return 0;
	}
	//sort(points, 0, N-1);
	sort(points, points + N, cmp);
	cout << fixed << setprecision(2) << ClosestPair(points, 0, N - 1);
	delete[] points;
	return 0;
}